#!/usr/bin/perl
# $Rev$
# by chudy_fernandez@yahoo.com
# modified by hallo.udin [asal copas , cukup ge bahan tertawa-an]
# http://www.facebook.com/groups/Mikrotik.Tulungagung maret2013


$|=1;
while (<>) {
    @X = split;
    $x = $X[0] . " ";
    $_ = $X[1];
    $u = $X[1];
             
             #----------------#
             #--- facebook ---#
             #----------------#

if (m/^http:\/\/photos-[a-z]?(\.ak\.fbcdn\.net)\/(.*?)\/(.*)/) {
        print $x . "http://photos" . $1 . "/" . $3 . "\n";

} elsif (m/^http:\/\/[a-z][0-9]\.sphotos(\.ak\.fbcdn\.net)\/(.*?)\/(.*)/) {
        print $x . "http://sphotos" . $1 . "/" . $3 . "\n";

} elsif (m/^http:\/\/(profile\.ak\.fbcdn\.net)\/(.*?)\/(.*)/) {
        print $x . "http://" . $1 . "/" . $3 . "\n";
                       
} elsif (m/^http:\/\/(video\.ak\.fbcdn\.net)\/(.*?)\/(.*\.mp4)\??.*$/) {
        print $x . "http://" . $1 . "/" . $3 . "\n";

} elsif (m/^http\:\/\/(photos-[a-z]\.ak\.fbcdn\.net|a[1-8]\.s?photos\.ak\.fbcdn\.net)\/h?photos-ak-.{4}(\/.*)/) {
	print $x . "http://photos.ak.fbcdn.SQUIDINTERNAL" . $2 . "\n";

} elsif (m/^http:\/\/profile\.ak\.fbcdn\.net\/h?profile-ak-.{4}(\/.*)/) {
	print $x . "http://profile.ak.fbcdn.SQUIDINTERNAL" . $1 . "\n";

} elsif (m/^http:\/\/video\.(.*)\.fbcdn\.net\/(.*?)\/([0-9_]+\.(mp4|flv|avi|mkv|m4v|mov|wmv|3gp|mpg|mpeg)?)(.*)/) {
	print $x . "http://video.ak.fbcdn.net/" . $3  . "\n";

        #game FB
} elsif (m/^http:\/\/cityvillefb[0-3]?(.static.zgncdn.com.*)/) {
        print $x . "http://cityvillefb" . $1  . "\n";
		
} elsif (m/^http:\/\/playerstatics[1-9]?(.poker.static.zynga.com.*)/) {
        print $x . "http://playerstatics.poker-zynga." . $1  . "\n";

} elsif (m/^http:\/\/kixeye[0-3]?(.cdn.kixeye.com.*)/) {
        print $x . "http://kixeye.com" . $1  . "\n";
		
} elsif (m/^http:\/\/zynga[1-9]?-a(.akamaihd.net.*)/) {
        print $x . "http://zynga-akamaihd.net." . $1  . "\n";
			
} elsif (m/^http:\/\/s[1-9]?(.ninja.game321.com.*)/) {
        print $x . "http://ninja-game321." . $1  . "\n";


             #----------------#
             #-- MAP / peta --#
             #----------------#
            
} elsif (m/^http:\/\/([a-z])[\d]{1,2}?(.gstatic\.com.*|\.wikimapia\.org.*)/) {
        print $x . "http://" . $1 . $2 . "\n";

} elsif (m/^http:\/\/.*\.[a-z][0-9]\.(tiles\.virtualearth\.net)\/(.*\&n=z)/) {
        print $x . "http://" . $1 . "/" . $2 . "\n";

} elsif (m/^http:\/\/imgv2-[0-9](\.scribdassets\.com.*)/) {
        print $x . "http://imgv2" . $1 . "\n";

} elsif (($u =~ /(khm|khms|cbk|cbks|mt|mw|mlt|mts)[0-9]\.(google|googleapis)\.co(m|\.uk|\.id)/) && (m/^http:\/\/([^\/]*?)\/(.*\&z=[\d]+)/)) {
        print $x . "http://map-srv.google.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (($u =~ /(khm|khms|cbk|cbks|mt|mw|mlt|mts)[0-9]\.(google|googleapis)\.co(m|\.uk|\.id)/) && (m/^http:\/\/([^\/]*?)\/(.*)/)) {
        print $x . "http://map-srv.google.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (m/^http:\/\/(.*\.google\.com)\/(edgedl\/[^\?\&\=]*\.[a-z]{3,4})(\?.*)?$/) {
        print $x . "http://chrome-srv.google.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (m/^http:\/\/(cbk|mt|khm|mlt|tbn)[0-9]?(.google\.co(m|\.uk|\.id).*)/) {
        print $x . "http://" . $1  . $2 . "\n";
		
} elsif (m/^http:\/\/([a-z])[0-9]?(\.gstatic\.com.*|\.wikimapia\.org.*)/) {
        print $x . "http://" . $1  . $2 . "\n";
		
} elsif (m/^http:\/\/.*\.[a-z][0-9]\.(tiles\.virtualearth\.net)\/(.*\&n=z)/) {
        print $x . "http://" . $1 . "/" . $2 . "\n";


             #---------------#
             #--- youtube ---#
             #---------------#

#} elsif ($u =~ /(youtube|googlevideo|google).*videoplayback\?/){
if ($X[1] =~ /(youtube|google).*videoplayback\?/){
        @itag = m/[&?](itag=[0-9]*)/;
        @id = m/[&\?\s](cp=[^\&\s]*)/;
        @expire = m/[&\?\s](expire=[^\&\s]*)/;
#        @range = m/[&?](range=[^\&\s]*)/;
#        @begin = m/[&?](begin=[^\&\s]*)/;
#        @redirect = m/[&?](redirect_counter=[^\&]*)/;
#        print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/@itag&@id@expire\n";
        print "";
} else {
        print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/@itag&@id@expire\n";}



        # youtube HD itag=22
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?\&(itag=22).*?\&(id=[a-zA-Z0-9]*)/) {
        print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $2 . "&" . $3 . "\n";

        # youtube Normal screen always HD itag 35, Normal screen never HD itag 34, itag=18 <--normal?
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?\&(itag=[0-9]*).*?\&(id=[a-zA-Z0-9]*)/) {
        print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $3 . "\n";

} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(videoplayback\?id=.*?|video_id=.*?)\&(.*?)/) {
        $z = $2; $z =~ s/video_id=/get_video?video_id=/;
        print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $z . "\n";

} elsif (m/^http:\/\/(.*\.yimg.com)\/(.*?)\/([^\?\&\=]*\.[^\/\?\&]{3,4})(\?.*)?$/) {
        print $x . "http://cdn.yimg.com//" . $3 . "\n";
        
} elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {
        print $x . "http://cdn.yimg.com/" . $3 . "\n";

} elsif (m/^http:\/\/([^\.]*)\.yimg\.com\/(.*)/) {
        @y = ($1,$2);
        $y[0] =~ s/[a-z]+([0-9]+)?/cdn/;
        $y[1] =~ s/&sig=.*//;
        print $x . "http://" . $y[0] . ".yimg.com/" . $y[1] . "\n";
	
 
                       #ubuntu update
} elsif (m/^http:\/\/(.*?)\/(ubuntu\/[a-zA-Z].*\/os\/.*)/) {
        print $x . "http://kambing.ui.ac.id.SQUIDINTERNAL/" . $2 . "\n";


        #mikrotik.tulungagung
} elsif (m/^http:\/\/i[1-9]{3}(.mikrotik.tulungagung.*)/) {
        print $x . "http://www.facebook.com/groups/Mikrotik.Tulungagung" . $1  . "\n";
		
        #photobucket
} elsif (m/^http:\/\/i[1-9]{3}(.photobucket.com.*)/) {
        print $x . "http://photobucket3." . $1  . "\n";

} elsif (m/^http:\/\/i[1-9]{4}(.photobucket.com.*)/) {
        print $x . "http://photobucket." . $1  . "\n";

        #Game non FB
	 #Game Garenanow
} elsif (m/^http:\/\/dl\.garenanow.com\/hon\/patcher\/(.*\.(exe|zip))\?/) {
        print $x . "http://dl.garena.SQUIDINTERNAL/" . $1 . "\n";

        #Google chrome update
} elsif (m/^http\:\/\/.*(pack.google.com.*)/) {
        print $x . "http://cdn." . $1 . "\n";

	 #Firefox Checked
} elsif (m/^http:\/\/.*?firefox\/releases\/(.*?)\/(firefox.*(mar|exe)?$)/) {
        print $x . "http://firefox.SQUIDINTERNAL/ " . $1 . "/" . $2 . "\n";
		
	 #Mozilla update partial
} elsif (m/^http:\/\/(.*?)\/(firefox\/releases)\/(.*?[a-z]{3})$/) {
        print $x . "http://mozilla.org.SQUIDINTERNAL/" . $2 . "/" . $3  . "\n";
		
	 #windws update      
} elsif (m/^http:\/\/i[1-9]{3}(.windowsupdate.com.*)/) {
        print $x . "http://windowsupdate.com." . $1  . "\n";

        #blogspot		
	 #Blogpost Checked 
} elsif (m/^http:\/\/[0-9]?.bp.blogspot\.com\/(.*)\/s.*?\/(.*(jpg|png|gif)?$)/) {
         print $x . "http:/bp.blogspot.com.SQUIDINTERNAL/" . $1 . "/" . $2 . "\n";
		
	 #http://lh6.ggpht.com/_pt7i0nbIOCY/SeBSfNbxQ_I/AAAAAAAABuA/lQToFnYZHKI/navhover_thumb%5B1%5D.png
} elsif (m/^http:\/\/lh[0-9]?.ggpht.com\/(.*?)\/(.*?)\/(.*?)\/(.*)\/(.*)?$/) {
        print $x . "http:/ggpht.SQUIDINTERNAL/"  . $1 . "/" .  $2 . "/" . $4 .  "/" .  $5 . "\n";
		
	 #http://a2.twimg.com/profile_images/1213095644/CBS-eye-white-bg_normal.jpg
} elsif (m/^http:\/\/a[0-5]?(.twimg.com.*)/) {
        print $x . "http://cdn-twimg.com." . $1  .  "\n";


        #ANTI VIRUS
        #AVAST
} elsif (m/^http:\/\/download[0-9]{3}.(avast.com.*)/) {
          print $x . "http://avast-cdn." . $1  .  "\n";

        #KAV
} elsif (m/^http:\/\/dnl-[0-9]{2}.(geo.kaspersky.com.*)/) {
          print $x . "http://kav-cdn." . $1  .  "\n";

        #AVG
} elsif (m/^http:\/\/(update.avg.com.*)/) {
          print $x . "http://avg-cdn." . $1  .  "\n";


############# dynamic content lain lain 

                     #google-analytics [google image search]
} elsif (m/^http:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
        print $x . "http://www.google-analytics.com/__utm.gif\n";

			#static3.spilcdn.com/
} elsif (m/^http:\/\/static[1-9]?(.speelcdn.com.*)/) {
          print $x . "http://speelcdn." . $1  .  "\n";

			#http://t1.gstatic.com
} elsif (m/^http:\/\/t[1-9]?(.gstatic.com.*)/) {
          print $x . "http://cdn-gstatic.com." . $1  .  "\n";

			# http://0.gravatar.com
} elsif (m/^http:\/\/[0-3]?(.gravatar.com.*)/) {
          print $x . "http://cdn-gravatar." . $1  .  "\n";

			#http://s5.scribdassets.com/images/attribution_noncommercial.png
} elsif (m/^http:\/\/s[1-8]?(.scribdassets.com.*)/) {
          print $x . "http://cdn-scribdassets." . $1  .  "\n";

			# http://tc2.easythumbhost.com/
} elsif (m/^http:\/\/tc[0-9]?(.easythumbhost.com.*)/) {
          print $x . "http://cdn-easythumbhost." . $1  .  "\n";

			#http://static7.spilcdn.com/tw/img/_/profile/dummy_small.png
} elsif (m/^http:\/\/static[1-7]?(.spilcdn.com.*)/) {
          print $x . "http://spilcdn." . $1  .  "\n";

			#http://media5.picsearch.com/is
} elsif (m/^http:\/\/media[1-8]?(.picsearch.com.*)/) {
          print $x . "http://cdn-picsearch." . $1  .  "\n";

			#http://lh3.googleusercontent.com/-z2ZV9VfLsc0/TmetBcUiRBI/AAAAAAAAC_k/-wvptlnDXuQ/03.png
} elsif (m/^http:\/\/lh[3-6]?(.googleusercontent.com.*)/) {
          print $x . "http://googleusercontent." . $1  .  "\n";

			#http://i54.tinypic.com/2crkryu.jpg
} elsif (m/^http:\/\/i[0-9]{2}(.tinypic.com.*)/) {
          print $x . "http://tinypic." . $1  .  "\n";
		  
		       
                         #Google android market
} elsif (m/^http:\/\/(.*\.android\.clients\.google\.com)\/(market\/[^\?\&\=]*)(\?.*)?$/) {
        print $x . "http://android-srv.google.com.SQUIDINTERNAL/" . $2 . "\n";

                         #Mozilla update
} elsif (m/^http:\/\/(.*?)\/(firefox\/releases\/.*)/) {
        print $x . "http://mozilla.org.SQUIDINTERNAL/" . $2 . "\n";

                         #Sourceforge mirror download
} elsif (m/^http:\/\/(.*\.dl\.sourceforge\.net)\/(.*)/) {
        print $x . "http://dl.sourceforge.net.SQUIDINTERNAL/" . $2 . "\n";

                         #Speedtest
} elsif (m/^http:\/\/(.*?)\/(speedtest\/.*\.(jpg|txt))\??.*$/) {
        print $x . "http://speedtest.net.SQUIDINTERNAL/" . $2 . "\n";

                         #Mediafire
} elsif (($u =~ /(199\.91\.[0-9]{1,3}\.[0-9]{1,3})|(205\.196\.[0-9]{1,3}\.[0-9]{1,3})/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/(.*)/)) {
        print $x . "http://mediafire.com.SQUIDINTERNAL/" . $3 . "\n";

                         #IPV4
} elsif (($u =~ /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/) && (m/^http:\/\/([^\/]*?)\/(thumbs|flv|key=|content).*?\/([^\/\?\&]*\.[\w\d]{3})\??.*$/)) {
        print $x . "http://vstreamcdn.com.SQUIDINTERNAL/" . $3 . "\n";

} elsif (($u =~ /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/) && (m/^http:\/\/([^\/]*?)\/remote_control.php.*?(file=.*)/)) {
        print $x . "http://webzilla.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (($u =~ /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/) && (m/^http:\/\/([^\/]*?)\/(.*\/[a-z]*\/thumbs.*)/)) {
        print $x . "http://webzilla.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (($u =~ /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/) && (m/^http:\/\/([^\/]*?)\/(.*\/t\/([^\?\&\=]*\.[a-z]{3}))$/)) {
        print $x . "http://midphase.com.SQUIDINTERNAL/" . $2 . "\n";

} elsif (m/^http:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
        print $x . "http://www.google-analytics.com/__utm.gif\n";

                        #cdn, variable.domain/.*/path/filename
} elsif (($u =~ /maxporn/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/([^\/]*?)(\?.*)?$/)) {
        print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";

                        #domain/.*/path/filename."ex", "ext" or "exte"
} elsif (($u =~ /filehippo/) && (m/^http:\/\/(.*?)(\.[^\/]*?)\/(.*?)\/([^\?\&\=]*)\.([\w\d]{2,4})\??.*$/)) {
        @y = ($1,$2,$4,$5);
        $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d]*)|([a-zA-Z]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

                        #domain/path/.*/filename."ex", "ext" or "exte"
} elsif (($u =~ /sharebeast/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?[^\/]*\/[^\/]*)\/(.*?)\/([^\?\&\=]*)\.([\w\d]{2,4})\??.*$/)) {
        @y = ($1,$2,$4,$5);
        $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d]*)|([a-zA-Z]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";
        
                        #domain/path/.*/path/filename
} elsif (($u =~ /fucktube/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?[^\/]*\/[^\/]*)\/(.*)\/([^\/]*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
        @y = ($1,$2,$4,$5,$6);
        $y[0] =~ s/(([a-zA-Z]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "." . $y[4] . "\n";


############################# Porno ######################################################

} elsif (($X[1] =~ /tube8|redtube|hardcore-teen|pornhub|tubegalore|xvideos|hostedtube|pornotube|redtubefiles/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?(\.[a-z]*)?)\.([a-z]*[0-9]?\.[^\/]{3}\/[a-z]*)(.*?)((\/[a-z]*)?(\/[^\/]*){4}\.[^\/\?]{3,4})(\?.*)?$/)) {
        print $x . "http://cdn." . $4 . $6 . "\n";
                        
} elsif (($X[1] =~ /maxporn/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/([^\/]*?)(\?.*)?$/)) {
        print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";

} elsif (m/^http:\/\/i[1-9]{3}(.imagehost123.com.*)/) {
        print $x . "http://imagehost123.com." . $1  . "\n";

} elsif (($u =~ /fucktube/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?[^\/]*\/[^\/]*)\/(.*)\/([^\/]*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
        @y = ($1,$2,$4,$5,$6);
        $y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "." . $y[4] . "\n";		
     
} elsif (($u =~ /media[0-9]{1,5}\.youjizz/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?\.[^\/]*)\/(.*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
        @y = ($1,$2,$4,$5);
        $y[0] =~ s/(([a-zA-Z]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

     

		
#File Shaaring
	 #filesharing mediafire checked maret 2012
}elsif (m/^http:\/\/199\.91\.15\d\.\d*\/(.*)\/(\w*)\/(.*)/) {
        print $x . "http://www.mediafire.com.SQUIDINTERNAL/" . $2 . "/" . $3 . "\n";

}elsif (m/^http:\/\/205\.196\.12\d\.\d*\/(.*)\/(\w*)\/(.*)/) {
        print $x . "http://www.mediafire.com.SQUIDINTERNAL/" . $2 . "/" . $3 . "\n";

	 #ziddu
} elsif (m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {
        print $x . "http://" . $1 . "\n";

	 #cdn, varialble 1st path
} elsif (($u =~ /filehippo|mediafire/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {
        @y = ($1,$2,$4,$5);
        $y[0] =~ s/[a-z0-9]{2,5}/cdn./;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

        #filesharing 4shared audio/video preview
} elsif (($X[1] =~ /4shared/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(dlink__2Fdownload_2F([^\/-]+))([a-zA-Z0-9-]+)\/([^\/\?\&]*\.[^\/\?\&]{2,3})(\?.*)?$/)) {
        @y = ($1,$2,$3,$4,$7);
        $y[0] =~ s/[a-z]+([0-9]+)?/cdn./;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "/" . $y[4] . "\n";
		
        #filesharing indowebster
} elsif (m/^http:\/\/(.*?)(\.jkt\.3d\.x\.indowebster.com)\/(.*?)\/([^\/\?\&]*)\.([^\/\?\&]{2,4})(\?.*?)$/) {
        @y = ($1,$2,$4,$5);
        $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d]*)|([a-zA-Z]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
        print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

	 #filesharing fileserve
}elsif (m/^http:\/\/fs\w*\.fileserve\.com\/file\/(\w*)\/[\w-]*\.\/(.*)/) {
	print $x . "http://www.fileserve.com.SQUIDINTERNAL/" . $1 . "./" . $2 . "\n";

	 #filesharing filesonic
}elsif (m/^http:\/\/s[0-9]*\.filesonic\.com\/download\/([0-9]*)\/(.*)/) {
	print $x . "http://www.filesonic.com.SQUIDINTERNAL/" . $1 . "\n";

	 #filesharing rapidshare
} elsif (($u =~ /rapidshare/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)([a-z]*\.[^\/]{3}\/[a-z]*\/[0-9]*)\/(.*?)\/([^\/\?\&]{4,})$/)) {
	print $x . "http://cdn." . $3 . "/SQUIDINTERNAL/" . $5 . "\n";


             #Cache High Latency Ads
} elsif (m/^http:\/\/([a-z0-9.]*)(\.doubleclick\.net|\.quantserve\.com|\.googlesyndication\.com|yieldmanager|cpxinteractive)(.*)/) {
        $y = $3;$z = $2;
        for ($y) {
        s/pixel;.*/pixel/;
        s/activity;.*/activity/;
        s/(imgad[^&]*).*/\1/;
        s/;ord=[?0-9]*//;
        s/;&timestamp=[0-9]*//;
        s/[&?]correlator=[0-9]*//;
        s/&cookie=[^&]*//;
        s/&ga_hid=[^&]*//;
        s/&ga_vid=[^&]*//;
        s/&ga_sid=[^&]*//;
        # s/&prev_slotnames=[^&]*//
        # s/&u_his=[^&]*//;
        s/&dt=[^&]*//;
        s/&dtd=[^&]*//;
        s/&lmt=[^&]*//;
        s/(&alternate_ad_url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
        s/(&url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
        s/(&ref=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
        s/(&cookie=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
        s/[;&?]ord=[?0-9]*//;
        s/[;&]mpvid=[^&;]*//;
        s/&xpc=[^&]*//;
        # yieldmanager
        s/\?clickTag=[^&]*//;
        s/&u=[^&]*//;
        s/&slotname=[^&]*//;
        s/&page_slots=[^&]*//;
        }
        print $x . "http://" . $1 . $2 . $y . "\n";

} elsif (m/^http:\/\/(.*?)\/(ads)\?(.*?)/) {
        print $x . "http://" . $1 . "/" . $2  . "\n";		
		
                            
                    #general purpose for cdn servers. add above your specific servers.
} elsif (m/^http:\/\/([0-9.]*?)\/\/(.*?)\.(.*)\?(.*?)/) {
        print $x . "http://squid-cdn-url//" . $2 . "." . $3 . "\n";

                        #generic http://variable.domain.com/path/filename."ex", "ext" or "exte"
} elsif (m/^http:\/\/(.*?)(\.[^\.\-]*?\..*?)\/([^\?\&\=]*)\.([\w\d]{2,4})\??.*$/) {
        @y = ($1,$2,$3,$4);
        $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn|kkcdn|fck)[-\w]*)|([a-zA-Z]+-?[0-9]+(-[a-zA-Z]*)?)|([0-9]{1,2})/cdn/;
        print $x . "storeurl://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

                        #generic http://variable.domain.com/path/filename non-ext
} elsif (m/^http:\/\/(.*?)(\.[^\.\-]*?\..*?)\/([^\?\&\=]*)\??.*$/) {
        @y = ($1,$2,$3);
        $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn|kkcdn|fck)[-\w]*)|([a-zA-Z]+-?[0-9]+(-[a-zA-Z]*)?)|([0-9]{1,2})/cdn/;
        print $x . "storeurl://" . $y[0] . $y[1] . "/" . $y[2] . "\n";

                        # all that ends with ;
} elsif (m/^http:\/\/(.*?)\/(.*?)\;(.*)/) {
        print $x . "http://" . $1 . "/" . $2 . "\n";

} else {
        print $x . $_ . "\n";
}
}